<style scoped>
    .main {
        height: 100%;
    }

    .main >>> .hd-logo {
        width: auto;
        height: 100%;
    }

    .main >>> .layout-logo {
        width: 36%;
    }

    .home-login {
        color: white;
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
    }

    .home-name {
        color: white;
        font-size: 18px;
        font-weight: bold;
        margin-right: 4px;
    }
</style>

<template>
    <div class="main">
        <main-theme1
                :siderWidth="220"
                ref="mainTheme"
                :headerMenusShow="closeHeaderMenu"
                logoPath="http://house-manager.oss-cn-qingdao.aliyuncs.com/logo.png">
            <router-view></router-view>
            <template slot="headerRight">
                <div class="home-name">{{ getUserName }} |</div>
                <div class="home-login" @click="logout">退出登录</div>
            </template>
        </main-theme1>
    </div>
</template>

<script>
import { mapActions } from 'vuex'

export default {
  data () {
    return {
      closeHeaderMenu: false
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo',
      'getPhpMenusData',
      'getJavaMenusData',
      'setBreadCrumb'
    ]),
    logout () {
      this.$refs.mainTheme.logout()
    }
  },
  computed: {
    getUserName () {
      return this.$store.state.user.severUserInfo.company_code
    }
  },
  mounted () {
    this.getUserInfo().then(resx => {
    })
    if (this.$config.phpMenu) {
      this.getPhpMenusData(1)
    } else {
      // TODO 如果是java菜单还需要调用综合菜单-id需要自己配置
      this.getJavaMenusData('0,1,6d97b32d-1cd9-11ea-878e-b8599f27b95c')
    }
  }
}
</script>
